package com.example.wanandroid.service.impl;

import com.example.wanandroid.mapper.QuestionMapper;
import com.example.wanandroid.pojo.Question;
import com.example.wanandroid.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Desc TODO
 * @Author 小强
 * @Date 2020/4/17 20:59
 */
@Service
public class QuestionServiceImpl implements QuestionService {
    @Autowired
    QuestionMapper questionMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return questionMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Question record) {
        return questionMapper.insertSelective(record);
    }

    @Override
    public Question selectByPrimaryKey(Long id) {
        return questionMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKey(Question record) {
        return questionMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<Question> listMyQuestions(Long userid, int start, int pageSize) {
        return questionMapper.listMyQuestions(userid, start, pageSize);
    }

    @Override
    public List<Question> listAllQuestions(int start, int pageSize) {
        return questionMapper.listAllQuestions(start, pageSize);
    }
}
